//
//  UIView+Extension.swift
//  weibo.chb
//
//  Created by 褚红彪 on 16/1/20.
//  Copyright © 2016年 chuhongbiao. All rights reserved.
//
//创建这么个分类用来给UIView在xib中增加几个属性，这样可以在右边的设置面板中直接设置
import UIKit
extension UIView{
    @IBInspectable var cornerRadius: CGFloat{
        get{
            return layer.cornerRadius
        }
        set{
            layer.cornerRadius = newValue
            layer.masksToBounds = cornerRadius > 0
        }
    }
    @IBInspectable var borderWidth: CGFloat{
        get{
            return layer.borderWidth
        }
        set{
            layer.borderWidth = newValue
        }
    }
    @IBInspectable var borderColor: UIColor?{
        get{
            guard let c = layer.borderColor else {
                return nil
            }
            return UIColor(CGColor: c)
        }
        set{
            layer.borderColor = newValue!.CGColor
        }
    }
}
